package 作业四1;

import 作业四.ATM;

import java.util.Random;
import java.util.Scanner;

public class ATM2Test {
    public static void main(String[] args) {
        double balance=10000;
        ATM atm=new ATM();
        atm.TakeNumber();
        Scanner sc1=new Scanner(System.in);
        int n1=sc1.nextInt();

        while (true) {
            System.out.println("请选择办理具体事务");
            if (n1==1) {
                Random random = new Random();
                int num2 = random.nextInt(100);
                System.out.println("您的号码为" + num2);
                atm.Transact();

            }else if (n1==2) {
                System.out.println("不文明不予以办理");
                break;
            }
            Scanner scanner2=new Scanner(System.in);
            int num=scanner2.nextInt();
            if (num==1){
                System.out.println("请输入取款金额：");
                Scanner scanner3=new Scanner(System.in);
                int money=scanner3.nextInt();
                System.out.println("您取款金额为"+money);
                balance=balance-money;
                System.out.println("余额为"+balance);
                atm.evaluate();
                Scanner scanner6=new Scanner(System.in);
                int n2=scanner6.nextInt();

            }else if (num==2){
                System.out.println("请输入存款金额：");
                Scanner scanner4=new Scanner(System.in);
                int money=scanner4.nextInt();
                System.out.println("您的存款金额为");
                System.out.println(money);
                balance=balance+money;
                System.out.println("余额为"+balance);
                atm.evaluate();
                Scanner scanner7=new Scanner(System.in);
                int n3=scanner7.nextInt();
            }else if (num==3){
                System.out.println("请输入转账金额：");
                Scanner scanner5=new Scanner(System.in);
                int money=scanner5.nextInt();
                System.out.println("您的转账金额为"+money);
                balance=balance+money;
                System.out.println("余额为"+balance);
                atm.evaluate();
                Scanner scanner8=new Scanner(System.in);
                int n4=scanner8.nextInt();
            }else if (num==4){
                System.out.println("退出");
               break;

            }

        }



    }
}
